from rest_framework import serializers

from .models import User


class UserSerializer(serializers.HyperlinkedModelSerializer):
    created_at = serializers.DateTimeField(read_only=True,
                                           format='%Y-%m-%dT%H:%M:%SZ')
    updated_at = serializers.DateTimeField(read_only=True,
                                           format='%Y-%m-%dT%H:%M:%SZ')

    class Meta:
        model = User
        fields = ('id', 'email', 'username', 'fullname', 'sex',
                  'mobile_number', 'url', 'created_at', 'updated_at')
